#include "PriorityQueue.h"

using namespace std;
PriorityQueue::PriorityQueue(QueueType type, int size)
{
	_type = type;

	switch (type)
	{
		case heap :
			_heap = new Heap(size);
			break;
		
		case unordered :
			_uno = new UnorderedArray(size);
			break;	
	}	
}
PriorityQueue::~PriorityQueue()
{
	switch (_type)
	{
		case heap :
			delete _heap;
			break;
			
		case unordered :
			delete _uno;
			break;	
	}
}

void PriorityQueue::insert(Edge *newEdge)
{
	switch (_type)
	{
		case heap :
			_heap->insert(newEdge);
			break;
				
		case unordered :
			_uno->insert(newEdge);
			break;	
	}
}

Edge* PriorityQueue::deleteMin()
{
	Edge *e = NULL;
	switch (_type)
	{
		case heap :
			e = _heap->deleteMin();
			break;
		
		case unordered :
			e = _uno->deleteMin();
			break;	
	}
	return e;
}

void PriorityQueue::clear()
{
	switch (_type)
	{
		case heap :
			_heap->clear();
			break;
		
		case unordered :
			_uno->clear();
			break;	
	}
}


